import axios from "@/utils/http";
export const listTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/list",
    method: "post",
  });
export const deleteTask = (taskId, options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/" + taskId,
    method: "delete",
  });
export const batchDeleteTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/",
    method: "delete",
  });
  export const batchEnabledTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/enabled",
    method: "put",
  });
export const batchDisabledTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/disabled",
    method: "put",
  });
export const addTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/",
    method: "post",
  });

export const updateTask = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/",
    method: "put",
  });
  export const verifyCron = (options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/verify",
    method: "post",
  });
  export const runTask = (taskId,options) =>
  axios.request({
    ...options,
    url: "/api/v1/task/"+taskId,
    method: "post",
  });
export default { listTask, deleteTask, addTask, updateTask,verifyCron };
